[<<Previous Entry]
[^^Up^^]
[Next Entry>>]
[Menu]
[About The Guide]
V_FILE2VLF()
Copy a DOS file into a VLF
-------------------------------------------------------------------------------
Syntax
V_FILE2VLF( <cFileName>,
<cOldPointer> ) -> cNewPointer
Arguments
<cFileName> is the name of a disk file optionally including the
path and drive designators.
<cOldPointer> is a required six byte pointer-field or variable in
which you have previously stored a pointer to variable length
data. Passing six spaces causes FlexFile to assume that there is
no old data to be released before the new <exp> data is saved.
Returns
V_FILE2VLF() returns a pointer which should be stored in the
pointer- field with which the copied file is to be associated.
V_FILE2VLF() returns (.F.) on error. This causes the error system
to be invoked with a "Data Type Mismatch". Use V_ERROR() to fetch
the specific error value (see Appendix B for a table of error
descriptions).
A typical error from this function is "File not found". It is,
therefore, the responsibility of the programmer to test for this
condition before executing V_FILE2VLF().
Description
V_FILE2VLF() provides a mechanism for copying a DOS disk file into
a VLF. This is particularly handy in converting an application
which has used Clipper's MEMOWRITE() function.
V_FILE2VLF() is also handy for copying graphics images from disk
files into a DBV file. When used in conjunction with V_VLF2FILE()
a system can be implemented to handle graphics images which is
compatible with the file based graphics systems such as DGE,
SilverPaint, Flipper and the like.
+-------------------------- WARNING --------------------------+
| V_FILE2VLF() deletes the data associated with <cOldPointer> |
| before returning <cNewPointer>. Attempting to use |
| <cOldPointer> after this function deletes the data that it |
| points to can corrupt the DBV file. |
+-------------------------------------------------------------+
Notes
. No additional memory is required to copy a file into a VLF. It
is, therefore, possible to import a file larger than 65K
(Clipper's variable size limit).
. V_TYPE() will return "C" (character) for any VLF that has been
created by V_FILE2VLF(). This implies that V_RETRIEVE() will
return a character string.
Examples
// Open a DBF file and its related DBV file
// The dbf_file has a 12 byte field called "exe_name"
// and the usual 6 byte field called "vlf"
USE dbf_file
ZAP
INDEX ON exe_name TO dbf_file
V_USE( "dbv_file" )
// This may seem silly, but lets store the Clipper compiler
// in the DBV file.
APPEND BLANK
REPLACE exe_name WITH "CLIPPER.EXE"
// This will copy the Clipper.exe into a VLF.
REPLACE vlf WITH V_FILE2VLF( exe_name, vlf )
// Later when we want to execute Clipper (you better have
// lots of memory).
SEEK "CLIPPER.EXE"
? V_VLF2FILE( "TEMP.EXE", vlf )
? V_ERROR()
RUN temp
See Also:
V_VLF2FILE()
V_RETRIEVE()
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson